package com.xw.common;

import com.google.common.collect.Sets;

import java.util.Set;

/**
 * Created by geely
 */
public class Const {


    public static final String CURRENT_USER = "currentUser";

    public static final String EMAIL = "email";
    public static final String USERNAME = "username";
    public static final String TOKEN_PREFIX = "token_";

    /**
     *  传入页面的url变量名
     */
    public static final String URL = "url";
    /**
     * app验证失败
     */
    public static final String CHECK_APP = "app验证失败";
    /**
     * 超级学吧appid
     */
    public static final String CJXB_APPID = "cjxb";
    /**
     * 您的账号在另外一台设备登录，请重新登录
     */
    public static final String REMOTE_LOGIN_MSG = "您的账号在另外一台设备登录，请重新登录";
    /**
     * 您的账号被禁用
     */
    public static final String DISABLE = "您的账号被禁用，请联系管理员";
    /**
     * 手机号已存在
     */
    public static final String PHONE_IS_EXIST = "手机号已存在";
    /**
     * 密码修改成功
     */
    public static final String UPDATE_PWD_SUCCESS = "密码修改成功";
    /**
     * 密码修改失败
     */
    public static final String UPDATE_PWD_ERROR = "密码修改失败";
    /**
     * 注册成功
     */
    public static final String REGISTER_SUCCESS = "注册成功";
    /**
     * 注册失败
     */
    public static final String REGISTER_ERROR = "注册失败";
    /**
     * 用户已存在，请直接登录
     */
    public static final String USER_IS_EXIST = "用户已存在，请直接登录";
    /**
     * 用户不存在
     */
    public static final String USER_IS_NOT_EXIST = "用户不存在";
    /**
     * 登录成功
     */
    public static final String LOGIN_SUCCESS = "登录成功";
    /**
     * 登录失败
     */
    public static final String LOGIN_ERROR = "登录失败";
    /**
     * 未绑定微信
     */
    public static final String WX_NOT_BIND = "未绑定微信";
    /**
     * 未绑定QQ
     */
    public static final String QQ_NOT_BIND = "未绑定QQ";
    /**
     * 服务器地址
     */
    public static final String WEB_URL = "http://sea.xuanwumobile.com";
    /**
     * 加盐
     */
    public static final String MD5_SALT = "ELF";

    /**
     * 父级id为 “0” 的状态
     */
    public static final String PID_ZERO="0";

    /**
     * 成功的状态值
     */
    public static final int SUCCESS_CODE=200;
    /**
     * 成功的状态值String
     */
    public static final String SUCCESS_CODE_STR="200";

    /**
     * 失败的状态值
     */
    public static final int ERROR_CODE=500;

    /**
     * 操作成功的msg
     */
    public static final String UCPAAS_SUCCESS_CODE="000000";
    /**
     * 操作成功的msg
     */
    public static final String OPREATE_MSG_SUCCESS="Operation successful";

    /**
     * 操作失败的msg
     */
    public static final String OPREATE_MSG_ERROR="Operation failure";
    /**
     * 一天发送短信最大条数
     */
    public static final int SEND_CODE_DAY_COUNT=5;
    /**
     * 一分钟发送短信最大条数
     */
    public static final int SEND_CODE_MIN_COUNT=1;
    /**
     * 验证码有效时间（分钟）
     */
    public static final int SEND_CODE_VALID_MIN=5;
    /**
     * 当天发送短信条数已达上限
     */
    public static final String SEND_CODE_DAY_ERROR="当天发送短信条数已达上限";
    /**
     * 1分钟只能发送1条短信，请稍后再试
     */
    public static final String SEND_CODE_MIN_ERROR="1分钟只能发送1条短信，请稍后再试";

    /**
     *  参数错误 （包含空状态）
     */
    public static String parameterError(String parea){
        return parea+"参数错误";
    }
    /**
     * 参数不能为空
     */
    public static final String PARA_IS_NULL="参数不能为空";

    /**
     * 验证码有误
     */
    public static final String CODE_ERROR="验证码有误";


    public interface RedisCacheExtime{
        int REDIS_SESSION_EXTIME = 60 * 30;//30分钟
    }
    public interface ProductListOrderBy{
        Set<String> PRICE_ASC_DESC = Sets.newHashSet("price_desc","price_asc");
    }

    public interface Cart{
        int CHECKED = 1;//即购物车选中状态
        int UN_CHECKED = 0;//购物车中未选中状态

        String LIMIT_NUM_FAIL = "LIMIT_NUM_FAIL";
        String LIMIT_NUM_SUCCESS = "LIMIT_NUM_SUCCESS";
    }

    public interface Role{
        int ROLE_CUSTOMER = 0; //普通用户
        int ROLE_ADMIN = 1;//管理员
    }

    public enum ProductStatusEnum{
        ON_SALE(1,"在线");
        private String value;
        private int code;
        ProductStatusEnum(int code,String value){
            this.code = code;
            this.value = value;
        }

        public String getValue() {
            return value;
        }

        public int getCode() {
            return code;
        }
    }


    public enum OrderStatusEnum{
        CANCELED(0,"已取消"),
        NO_PAY(10,"未支付"),
        PAID(20,"已付款"),
        SHIPPED(40,"已发货"),
        ORDER_SUCCESS(50,"订单完成"),
        ORDER_CLOSE(60,"订单关闭");


        OrderStatusEnum(int code,String value){
            this.code = code;
            this.value = value;
        }
        private String value;
        private int code;

        public String getValue() {
            return value;
        }

        public int getCode() {
            return code;
        }

        public static OrderStatusEnum codeOf(int code){
            for(OrderStatusEnum orderStatusEnum : values()){
                if(orderStatusEnum.getCode() == code){
                    return orderStatusEnum;
                }
            }
            throw new RuntimeException("么有找到对应的枚举");
        }
    }
    public interface  AlipayCallback{
        String TRADE_STATUS_WAIT_BUYER_PAY = "WAIT_BUYER_PAY";
        String TRADE_STATUS_TRADE_SUCCESS = "TRADE_SUCCESS";

        String RESPONSE_SUCCESS = "success";
        String RESPONSE_FAILED = "failed";
    }



    public enum PayPlatformEnum{
        ALIPAY(1,"支付宝");

        PayPlatformEnum(int code,String value){
            this.code = code;
            this.value = value;
        }
        private String value;
        private int code;

        public String getValue() {
            return value;
        }

        public int getCode() {
            return code;
        }
    }

    public enum PaymentTypeEnum{
        ONLINE_PAY(1,"在线支付");

        PaymentTypeEnum(int code,String value){
            this.code = code;
            this.value = value;
        }
        private String value;
        private int code;

        public String getValue() {
            return value;
        }

        public int getCode() {
            return code;
        }


        public static PaymentTypeEnum codeOf(int code){
            for(PaymentTypeEnum paymentTypeEnum : values()){
                if(paymentTypeEnum.getCode() == code){
                    return paymentTypeEnum;
                }
            }
            throw new RuntimeException("么有找到对应的枚举");
        }

    }

    public interface  REDIS_LOCK{
        String CLOSE_ORDER_TASK_LOCK = "CLOSE_ORDER_TASK_LOCK";//关闭订单的分布式锁
    }




}
